package helper

import (
	"github.com/beherochuling/beesoft_api/app/helper/helper/internal"
	"github.com/beherochuling/beesoft_api/app/model"
	"github.com/gogf/gf/v2/os/gtime"
	"math/rand"
	"time"
)

var Faker = faker{}

type faker struct{}

func (faker) RandomDateFuture() string {
	min := time.Now().Unix()
	max := time.Now().Unix() * 10 / 9
	delta := max - min

	sec := rand.Int63n(delta) + min
	randTime := time.Unix(sec, 0)

	return gtime.New(randTime).Format(model.TimeFormat)
}
func (faker) RandomDatePast() string {
	min := time.Now().Unix() - (time.Now().Unix() * 2 / 10)
	max := time.Now().Unix()
	delta := max - min

	sec := rand.Int63n(delta) + min
	randTime := time.Unix(sec, 0)

	return gtime.New(randTime).Format(model.TimeFormat)
}
func (faker) RandomDateRecent() string {
	min := time.Now().Unix() - (time.Now().Unix() * 1 / 200)
	max := time.Now().Unix()
	delta := max - min

	sec := rand.Int63n(delta) + min
	randTime := time.Unix(sec, 0)

	return gtime.New(randTime).Format(model.TimeFormat)
}

func (faker) GetSonyID(startTime ...time.Time) uint64 {
	return internal.CreateSonyID(startTime...)
}
